home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kopete / kopeteprefs.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-10-08  |  11.1 KB  |  319 lines

  1. /*
  2.     kopeteprefs.cpp - Kopete Preferences Container-Class
  3.  
  4.     Copyright (c) 2002      by Stefan Gehn            <metz AT gehn.net>
  5.     Kopete    (c) 2002-2005 by the Kopete developers  <kopete-devel@kde.org>
  6.  
  7.     *************************************************************************
  8.     *                                                                       *
  9.     * This library is free software; you can redistribute it and/or         *
  10.     * modify it under the terms of the GNU Lesser General Public            *
  11.     * License as published by the Free Software Foundation; either          *
  12.     * version 2 of the License, or (at your option) any later version.      *
  13.     *                                                                       *
  14.     *************************************************************************
  15. */
  16.  
  17. #ifndef __KOPETEPREFS_H__
  18. #define __KOPETEPREFS_H__
  19.  
  20. #include <qobject.h>
  21. #include <kdeversion.h>
  22. #include <qcolor.h>
  23. #include <qfont.h>
  24.  
  25. #include "kopete_export.h"
  26.  
  27. class KConfig;
  28.  
  29. class KOPETE_EXPORT KopetePrefs : public QObject
  30. {
  31.     Q_OBJECT
  32.     // here so we can use Qt to translate enums<-->strings
  33.     Q_PROPERTY( ContactDisplayMode contactListDisplayMode READ contactListDisplayMode WRITE setContactListDisplayMode )
  34.     Q_PROPERTY( IconDisplayMode contactListIconMode READ contactListIconMode WRITE setContactListIconMode )
  35.         Q_ENUMS( ContactDisplayMode IconDisplayMode )
  36.  
  37. public:
  38.     /**
  39.      * The prefs container-class is a singleton object. Use this method to retrieve
  40.      * the instance.
  41.      */
  42.     static KopetePrefs *prefs();
  43.  
  44.     /**
  45.      * Reads all pref-variables from KConfig
  46.      * usually you don't need this as KopetePrefs loads settings
  47.      * when an instance is created
  48.      */
  49.     void load();
  50.  
  51.     /**
  52.      * Stores all pref-variables into KConfig
  53.      */
  54.     void save();
  55.  
  56.     QString iconTheme() const { return mIconTheme; }
  57.     bool useEmoticons() const { return mUseEmoticons; }
  58.     bool showOffline() const { return mShowOffline; }
  59.     bool showEmptyGroups() const { return mShowEmptyGroups; }
  60.     bool treeView() const { return mTreeView; }
  61.     bool sortByGroup() const { return mSortByGroup; }
  62.     bool greyIdleMetaContacts() const { return mGreyIdle; }
  63.     bool startDocked() const { return mStartDocked; }
  64.     bool useQueue() const { return mUseQueue; }
  65.     bool useStack() const { return mUseStack; }
  66.     bool raiseMsgWindow() const{ return mRaiseMsgWindow; }
  67.     bool showEvents() const{ return mShowEvents; }
  68.     bool trayflashNotify() const { return mTrayflashNotify; }
  69.     bool spellCheck() const { return mSpellCheck; }
  70.     bool queueUnreadMessages() const { return mQueueUnreadMessages; }
  71.     bool queueOnlyHighlightedMessagesInGroupChats() const { return mQueueOnlyHighlightedMessagesInGroupChats; }
  72.     bool queueOnlyMessagesOnAnotherDesktop() const { return mQueueOnlyMessagesOnAnotherDesktop; }
  73.     bool trayflashNotifyLeftClickOpensMessage() const { return mTrayflashNotifyLeftClickOpensMessage; }
  74.     bool trayflashNotifySetCurrentDesktopToChatView() const { return mTrayflashNotifySetCurrentDesktopToChatView; }
  75.     bool balloonNotify() const { return mBalloonNotify; }
  76.     bool balloonNotifyIgnoreClosesChatView() const { return mBalloonNotifyIgnoreClosesChatView; }
  77.     bool balloonClose() const { return mBalloonClose; }
  78.     int balloonCloseDelay() const { return mBalloonCloseDelay; }
  79.     bool soundIfAway() const { return mSoundIfAway; }
  80.     int chatViewBufferSize() const { return mChatViewBufferSize; }
  81.     int rememberedMessages() const { return mRememberedMessages; }
  82.     const QColor &highlightBackground() const { return mHighlightBackground; }
  83.     const QColor &highlightForeground() const { return mHighlightForeground; }
  84.     const QColor &textColor() const { return mTextColor; }
  85.     const QColor &bgColor() const { return mBgColor; }
  86.     const QColor &linkColor() const { return mLinkColor; }
  87.     const QFont &fontFace() const { return mFontFace; }
  88.     const QColor &idleContactColor() const { return mIdleContactColor; }
  89.     bool highlightEnabled() const { return mHighlightEnabled; }
  90.     bool bgOverride() const { return mBgOverride; }
  91.     bool fgOverride() const { return mFgOverride; }
  92.     bool rtfOverride() const { return mRtfOverride; }
  93.  
  94.     QString interfacePreference() const { return mInterfacePreference; }
  95.     bool showTray() const { return mShowTray; }
  96.     bool richText() const { return mRichText; }
  97.     bool chatWShowSend() const { return mChatWShowSend; }
  98.     bool autoConnect() const { return mAutoConnect; }
  99.  
  100.     int chatWindowPolicy() const { return mChatWindowPolicy; }
  101.  
  102.     //Styles
  103.     QString defaultTheme() const { return QString::fromLatin1("Default"); }
  104.     //for Adium (xhtml+css)
  105.     QString stylePath() const { return mStylePath; }
  106.     QString styleVariant() const { return mStyleVariant; }
  107.  
  108.     QStringList toolTipContents() const { return mToolTipContents; }
  109.  
  110.     ///
  111.     enum ContactDisplayMode { Classic, RightAligned, Detailed, Yagami, Default = Classic };
  112.     ///
  113.     enum IconDisplayMode { IconPic, PhotoPic, IconDefault = IconPic };
  114.     bool contactListIndentContacts() const { return mContactListIndentContacts; }
  115.     ContactDisplayMode contactListDisplayMode() const { return mContactListDisplayMode; }
  116.     IconDisplayMode contactListIconMode() const { return mContactListIconMode; }
  117.     bool contactListUseCustomFonts() const { return mContactListUseCustomFonts; }
  118.     QFont contactListCustomNormalFont() const { return mContactListNormalFont; }
  119.     QFont contactListCustomSmallFont() const { return mContactListSmallFont; }
  120.     QFont contactListSmallFont() const;
  121.     QColor contactListGroupNameColor() const { return mContactListGroupNameColor; }
  122.     bool contactListAnimation() const { return mContactListAnimation; }
  123.     bool contactListFading() const { return mContactListFading; }
  124.     bool contactListFolding() const { return mContactListFolding; }
  125.     bool contactListAutoHide() const { return mContactListAutoHide; }
  126.     unsigned int contactListAutoHideTimeout() const { return mContactListAutoHideTimeout; }
  127.  
  128.     bool reconnectOnDisconnect() const { return mReconnectOnDisconnect; }
  129.  
  130.     bool truncateContactNames() const { return mTruncateContactNames; }
  131.     int maxConactNameLength() const { return mMaxContactNameLength; }
  132.     bool emoticonsRequireSpaces() const { return mEmoticonsRequireSpaces; }
  133.     bool groupConsecutiveMessages() const { return mGroupConsecutiveMessages; }
  134.  
  135.     void setIconTheme(const QString &value);
  136.     void setUseEmoticons(bool value);
  137.     void setShowOffline(bool value);
  138.     void setShowEmptyGroups(bool value);
  139.     void setTreeView(bool);
  140.     void setSortByGroup(bool);
  141.     void setGreyIdleMetaContacts(bool);
  142.     void setStartDocked(bool);
  143.     void setUseQueue(bool);
  144.     void setUseStack(bool);
  145.     void setRaiseMsgWindow(bool);
  146.     void setShowEvents(bool);
  147.     void setTrayflashNotify(bool);
  148.     void setSpellCheck(bool);
  149.     void setQueueUnreadMessages(bool);
  150.     void setQueueOnlyHighlightedMessagesInGroupChats(bool);
  151.     void setQueueOnlyMessagesOnAnotherDesktop(bool);
  152.     void setTrayflashNotifyLeftClickOpensMessage(bool);
  153.     void setTrayflashNotifySetCurrentDesktopToChatView(bool);
  154.     void setBalloonNotify(bool);
  155.     void setBalloonNotifyIgnoreClosesChatView(bool);
  156.     void setSoundIfAway(bool);
  157.     void setBeepNotify(bool);
  158.     void setChatWindowPolicy(int);
  159.     void setStylePath(const QString &);
  160.     void setStyleVariant(const QString &);
  161.     void setChatViewBufferSize(int);
  162.     void setHighlightBackground(const QColor &);
  163.     void setHighlightForeground(const QColor &);
  164.     void setHighlightEnabled(bool);
  165.     void setBgOverride(bool);
  166.     void setFgOverride(bool);
  167.     void setRtfOverride(bool);
  168.     void setInterfacePreference(const QString &viewPlugin);
  169.     void setTextColor(const QColor &);
  170.     void setBgColor(const QColor &);
  171.     void setLinkColor(const QColor &);
  172.     void setFontFace(const QFont &);
  173.     void setIdleContactColor(const QColor &);
  174.     void setShowTray(bool);
  175.     void setRichText(bool);
  176.     void setRememberedMessages(int);
  177.     void setToolTipContents(const QStringList &);
  178.     void setContactListIndentContacts( bool v );
  179.     void setContactListDisplayMode( ContactDisplayMode v );
  180.     void setContactListIconMode( IconDisplayMode v );
  181.     void setContactListUseCustomFonts( bool v );
  182.     void setContactListCustomNormalFont( const QFont & v );
  183.     void setContactListCustomSmallFont( const QFont & v );
  184.     void setContactListGroupNameColor( const QColor & v );
  185.     void setContactListAnimation( bool );
  186.     void setContactListFading( bool );
  187.     void setContactListFolding( bool );
  188.     void setContactListAutoHide( bool );
  189.     void setContactListAutoHideTimeout( unsigned int );
  190.     void setReconnectOnDisconnect( bool newSetting );
  191.     void setTruncateContactNames( bool );
  192.     void setMaxContactNameLength( int );
  193.     void setAutoConnect( bool );
  194.     void setEmoticonsRequireSpaces( bool );
  195.     void setBalloonClose( bool );
  196.     void setBalloonDelay( int );
  197.     void setGroupConsecutiveMessages( bool );
  198.  
  199. signals:
  200.     /**
  201.      * Emitted when config gets saved by save()
  202.      */
  203.     void saved();
  204.     /**
  205.      * Emitted when config gets saved by save() and a certain
  206.      * setting has changed.
  207.      * Naming scheme is the same as with the config vars.
  208.      */
  209.     void windowAppearanceChanged();
  210.     void messageAppearanceChanged();
  211.     void contactListAppearanceChanged();
  212.     /**
  213.      * Emitted when chat Window Style changed.
  214.      * @param stylePath New stylePath
  215.      */
  216.     void styleChanged(const QString &stylePath);
  217.     /**
  218.      * Emitted when ChatWindowStyle variant changed.
  219.      * @param variantPath New variant Path.
  220.      */
  221.     void styleVariantChanged(const QString &variantPath);
  222.  
  223. private:
  224.     /**
  225.      * Private constructor: we are a singleton
  226.      */
  227.     KopetePrefs();
  228.  
  229.     /**
  230.      * Our instance
  231.      */
  232.     static KopetePrefs *s_prefs;
  233.  
  234.     KConfig *config;
  235.  
  236.     QString mIconTheme;
  237.     bool mUseEmoticons;
  238.     bool mShowOffline;
  239.     bool mShowEmptyGroups;
  240.     bool mGreyIdle;
  241.     bool mTreeView;
  242.     bool mSortByGroup;
  243.     bool mStartDocked;
  244.     bool mUseQueue;
  245.     bool mUseStack;
  246.     bool mRaiseMsgWindow;
  247.     bool mShowEvents;
  248.     bool mTrayflashNotify;
  249.     bool mSpellCheck;
  250.     bool mQueueUnreadMessages;
  251.     bool mQueueOnlyHighlightedMessagesInGroupChats;
  252.     bool mQueueOnlyMessagesOnAnotherDesktop;
  253.     bool mTrayflashNotifyLeftClickOpensMessage;
  254.     bool mTrayflashNotifySetCurrentDesktopToChatView;
  255.     bool mBalloonNotify;
  256.     bool mBalloonNotifyIgnoreClosesChatView;
  257.     bool mBalloonClose;
  258.     int mBalloonCloseDelay;
  259.     bool mSoundIfAway;
  260.     int mRememberedMessages;
  261.     QString mInterfacePreference;
  262.     int mChatViewBufferSize;
  263.     QColor mHighlightBackground;
  264.     QColor mHighlightForeground;
  265.     QColor mTextColor;
  266.     QColor mBgColor;
  267.     QColor mLinkColor;
  268.     QFont mFontFace;
  269.     QColor mIdleContactColor;
  270.     bool mHighlightEnabled;
  271.     bool mBgOverride;
  272.     bool mFgOverride;
  273.     bool mRtfOverride;
  274.     bool mShowTray;
  275.     bool mWindowAppearanceChanged;
  276.     bool mMessageAppearanceChanged;
  277.     bool mContactListAppearanceChanged;
  278.     bool mChatWShowSend;
  279.     bool mAutoConnect;
  280.  
  281.     int mChatWindowPolicy;
  282.  
  283.     bool mTruncateContactNames;
  284.     int mMaxContactNameLength;
  285.  
  286.     bool mRichText;
  287.  
  288.     // xhtml+css
  289.     //for Adium (xhtml+css)
  290.     QString mStylePath;
  291.     QString mStyleVariant;
  292.     bool mStylePathChanged;
  293.     bool mStyleVariantChanged;
  294.  
  295.     QStringList mToolTipContents;
  296.  
  297.     bool mContactListIndentContacts;
  298.     ContactDisplayMode mContactListDisplayMode;
  299.     IconDisplayMode mContactListIconMode;
  300.     bool mContactListUseCustomFonts;
  301.     QFont mContactListNormalFont;
  302.     QFont mContactListSmallFont;
  303.     QColor mContactListGroupNameColor;
  304.     bool mContactListAnimation;
  305.     bool mContactListFading;
  306.     bool mContactListFolding;
  307.     bool mContactListAutoHide;
  308.     unsigned int mContactListAutoHideTimeout;
  309.  
  310.     bool mReconnectOnDisconnect;
  311.     bool mEmoticonsRequireSpaces;
  312.     bool mGroupConsecutiveMessages;
  313.  
  314.     QString fileContents(const QString &path);
  315.     void _setStylePath (const QString &);
  316. };
  317. #endif
  318. // vim: set noet ts=4 sts=4 sw=4:
  319.